package com.gzy.rpsm_admin.controller;

import com.gzy.rpsm_admin.pojo.Building;
import com.gzy.rpsm_admin.pojo.PageResult;
import com.gzy.rpsm_admin.pojo.ResponsePojo;
import com.gzy.rpsm_admin.service.BuildingService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



@RestController
@Api(tags = "楼栋相关接口")
public class BuildingController {
    @ApiOperation(value = "楼栋分页查询",
    response = Building.class,
    responseContainer = "list",
    produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({ @ApiImplicitParam(name = "current", value = "当前页码",
            defaultValue = "1",dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页行数",dataType = "Integer",paramType = "query",defaultValue = "10"),
            @ApiImplicitParam(name = "number", value = "楼栋号",dataType = "String",paramType = "query")
    })

    @GetMapping("/page/building")
    public ResponsePojo<PageResult<Building>> pageOfBuilding
            (@RequestParam( defaultValue = "1") Integer current,
             String number,
             @RequestParam( defaultValue = "10") Integer size) {
        PageResult<Building> result = buildingService.PageOfBuilding(current, size, number);
        return ResponsePojo.success(result);
    }
    @Autowired
public BuildingService buildingService;



}

